****************************************************************************
* File-Name: 		march.do
* Date:		 09/01/2022
* Author: 		Fred Batista
* Purpose: 		Main Analysis March for survey experiment
* Data used: 		march.dta
* Data Output:	None	*/
****************************************************************************

**** VARIABLES

* Worried about Covid: p18
* Experimental conditions: p13
* Bolsonaro�s approval: p3
* Bolsosnaro�s administration better or worse than expected: p4
* 2018 vote: p7
* 2022 vote: p8
* partisanship: p5
* antipartisanship: p6
* views on science: p9-p12
* main source of information: p30
* religion: p31
* left-right ideology: p32
* income: p33
* sex: var34
* age: var35
* region: var36
* class: var37


***** RECODING VARIABLES

*** IV: Experimental Manipulation  (0=control; 1=bolsonaro; 2=oms; 3=both)

gen conditions = p13

recode conditions (4=0)


***  DV: worried about COVID

encode p18, gen (worriedcov)

recode worriedcov (1=2) (2=3) (3=0) (4=.) (5=1)

gen worriedcov01 = worriedcov/3


*** moderator (pre-treatment): Bolsonaro�s support

* evaluation of bolsonaro�s job performance

encode p3, gen(approval)

recode approval (1=4) (2=.) (3=0) (4=2) (5=3) (6=1) (7=5) 

gen approval01 = approval/5

* bolsonaro�s admin better or worse than expected (Dk combined as middle)

encode p4, gen(bolsoexp)

recode bolsoexp (1=2) (2 3=1) (4=0)

gen bolsoexp01 = bolsoexp/2

* 2018 vote (null and absent as neutral category)

encode p7, gen(vote18)

gen haddadvoter = vote18

recode haddadvoter (2=1) (else=0)

gen bolsovoter = vote18

recode bolsovoter (3=1) (else=0)

* 2022 vote (DK as neutral category)

encode p8, gen(vote22)

gen haddadfuture = vote22

recode haddadfuture (1=1) (else=0)

gen bolsofuture = vote22

recode bolsofuture (2=1) (else=0)

* general feelingsabout bolsonaro

polychoric approval01 bolsoexp01 bolsovoter bolsofuture

alpha approval01 bolsoexp01 bolsovoter bolsofuture, std

gen bolsoeval = (approval01 + bolsoexp01 + bolsovoter + bolsofuture)/4


*** moderator (pre-treatment): partisanship (petistas, antipetistas, otherpartisans, otherantipartisans, nonpartisans)

* party id (0 no, 1 other, 2 PT)

encode p5, gen(partyid)

recode partyid (6 10 12 15=0) (46 47 48 49 50 51 52 53 54=2) (else=1) 

* antiparty id (0 no, 1 other, 2 PT)

encode p6, gen(antiparty)

recode antiparty (10 12 22 23=0) (75 76 77 78 79 80 81 82 83 84 85 86=2) (else=1) 

* petistas

gen petistas = partyid

recode petistas (2=1) (else=0)

* antipetistas

gen antipetistas = 0

replace antipetistas = 1 if antiparty==2 & partyid==0

* otherpartisans

gen otherpartisans = partyid

recode otherpartisans (1=1) (else=0)

* otherpartisans

gen otherantipartisans =0

replace otherantipartisans = 1 if antiparty==1 & partyid==0

* nonpartisans

gen nonpartisans=0

replace nonpartisans=1 if antiparty==0 & partyid==0


*** moderator (pre-treatment): views on science (p9 and p11 inverted scales) - P9 was understood incorrectly by Rs, P11 does not tap the concept

encode p9, gen(science1)
encode p10, gen(science2)
encode p11, gen(science3)
encode p12, gen(science4)

recode science1 science3 (1=6) (2=5) (3=4) (4=3) (5=2) (6=1)

polychoric science1 science2 science3 science4

alpha science1 science2 science3 science4

* only science2 and science4 are highly correlated

gen science= (science2 + science4 -2)/10


*** control variables: 

* information sources

encode p30, gen(infosource)

gen sourcetv = infosource

recode sourcetv (1=1) (else=0)

gen sourcenet = infosource

recode sourcenet (5 6=1) (else=0)

* religion

encode p31, gen(religion)

gen catholic = religion

recode catholic (1=1)(else=0)

gen protestant = religion

recode protestant (2 6=1) (else=0)

* ideologia (higher is right)

encode p32, gen(ideo)

recode ideo (1=0) (2=1) (3=10) (4=2) (5=3) (6=4) (7=5) (8=6) (9=7) (10=8) (11=9)

gen ideo01 = ideo/10

* income

encode p33, gen(income)

recode income (9=.)

gen income01 = (income -1)/7

* sex (male=1)

encode var34, gen(male)

replace male = male - 1

* age

gen age = var35

gen age01 = (age-16)/83

* region

encode var36, gen(region)

* social class

encode var37, gen(class)

replace class = 5 - class

gen class01= class/4


****** DESCRIPTIVE STATISTICS

* descriptives for full sample (Table A1)

summarize worriedcov01 bolsoeval science age01 sourcetv sourcenet petistas antipetistas nonpartisans ideo01 catholic protestant income male class i.region

* descriptives for control group (Table A2)

summarize worriedcov01 bolsoeval science age01 sourcetv sourcenet petistas antipetistas nonpartisans ideo01 catholic protestant income male class i.region if condition==0

* dimensionality of support for bolsonaro (Table A4)

polychoric approval01 bolsoexp01 bolsovoter bolsofuture

alpha approval01 bolsoexp01 bolsovoter bolsofuture, std

factor approval01 bolsoexp01 bolsovoter bolsofuture, ml factor(1)


******* BALANCE CHECKS (Figure A5)

mlogit condition bolsoeval science age01 sourcetv sourcenet ideo01 catholic protestant income male class i.region


****** MAIN ANALYSES

**** ATE (Figure 1, TAble A6)

oprobit worriedcov i.condition

margins, predict(outcome(3)) at(condition=(0(1)3))

* plot

matrix point1 = (.7980503 \.7289492  \ .7603629 \.7664743)

matrix lb1 = ( .7526003 \ .6708899 \.7022531\.7166752)

matrix ub1 = (.8435003\.7870085\.8184727\ .8162735)

matrix cond1 = (1\2\3\4)

matrix matrix1 = point1, lb1, ub1, cond1

matrix list matrix1

svmat matrix1, name(a)

eclplot a1 a2 a3 a4, ciopts(blcolor(black) msize(vtiny)) estopts(color(black) m(circle)) yline(0, lcolor(black) lpattern(dash)) ylabel(.50 ".50" .60 ".60" .70 ".70" .80 ".80" .90 ".90" 1 "1.00", nogrid) xlabel(0.7 " " 1 `" "No" "Cue" "' 2 `" "Bolsonaro" "Cue""' 3 `" "WHO" "Cue" "' 4 `" "Both" "Cues" "' 4.3 " ", noticks labsize(medlarge) labgap(2) tl(2) nogrid) ylabel(, nogrid)  title({bf:Concern About Pandemic},size(vlarge) bmargin(4)) ytitle("") xtitle("")  ysize(8) xsize(8) graphregion(color(white)) plotregion(style(none)) xscale(noextend) yscale(noextend) saving(ate1)


**** HTE (Figure 2, Table A6)


oprobit worriedcov i.condition##c.bolsoeval

test (1.condition#c.bolsoeval=0) (2.condition#c.bolsoeval=0) (3.condition#c.bolsoeval=0), mtest(bon)

margins, dydx(1.condition) predict(outcome(3)) at(bolsoeval=(0(.1)1))

marginsplot, plot1(mcolor(black) connect(direct) lcolor(black)) ci1(lcolor(black) msize(vtiny)) ytitle("")  yline(0, lcolor(black) lpattern(dash)) xtitle(Bolsonaro Support, size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2" " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium)) ylabel(-.5 "-.50" -.25 "-.25" 0 ".00" .25 ".25" .5 ".50", nogrid) title({bf:Bolsonaro Cue}, color(black) size(large)) yline(0, lcolor(black) lpattern(dash)) yscale(noextend) xscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(hteconT1b)


margins, dydx(2.condition) predict(outcome(3)) at(bolsoeval=(0(.1)1))

marginsplot, plot1(mcolor(black) connect(direct) lcolor(black)) ci1(lcolor(black) msize(vtiny)) ytitle("")  yline(0, lcolor(black) lpattern(dash)) xtitle(Bolsonaro Support, size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2" " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium)) ylabel(-.5 "-.50" -.25 "-.25" 0 ".00" .25 ".25" .5 ".50", nogrid) title({bf:WHO Cue}, color(black) size(large)) yline(0, lcolor(black) lpattern(dash)) yscale(noextend) xscale(noextend)  plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(hteconT2b)

margins, dydx(3.condition) predict(outcome(3)) at(bolsoeval=(0(.1)1))

marginsplot, plot1(mcolor(black) connect(direct) lcolor(black)) ci1(lcolor(black) msize(vtiny)) ytitle("")  yline(0, lcolor(black) lpattern(dash)) xtitle(Bolsonaro Support, size(medlarge) margin(medsmall)) xlabel(0 "Lowest" .1 " " .2" " .3 " " .4 " " .5 " " .6 " " .7 " " .8 " " .9 " " 1 "Highest", labsize(medium)) ylabel(-.5 "-.50" -.25 "-.25" 0 ".00" .25 ".25" .5 ".50", nogrid) title({bf:Bolsonaro+WHO Cue}, color(black) size(large)) yline(0, lcolor(black) lpattern(dash)) yscale(noextend) xscale(noextend) plotregion(style(none) margin(medlarge)) graphregion(color(white) margin(medlarge)) ysize(8) xsize(8) saving(hteconT3b)

* combining HTE graphs for concern

graph combine hteconT1b.gph hteconT2b.gph hteconT3b.gph, ycommon title(, size(vlarge)) plotregion(style(none)) graphregion(color(white)) rows(1) ysize(5) xsize(14) iscale(1)


******** ROBUSTNESS CHECKS: 

* controlling for partisanship/antipartisanship (Table A8)

oprobit worriedcov i.condition##i.petistas i.condition##i.antipetistas

oprobit worriedcov i.condition##c.bolsoeval i.condition##i.petistas i.condition##i.antipetistas


* controlling for ideology (Table A9)

oprobit worriedcov i.condition##c.ideo01

oprobit worriedcov i.condition##c.bolsoeval i.condition##c.ideo01


* controlling for views on science (Table A10)

oprobit worriedcov i.condition##c.science

oprobit worriedcov i.condition##c.bolsoeval i.condition##c.science


* controlling for income (Table A11)

oprobit worriedcov i.condition##c.income

oprobit worriedcov i.condition##c.bolsoeval i.condition##c.income


*** reducing (only control grupo) and savind for appending with April data 

keep if condition==0

keep worriedcov01 bolsoeval age01 sourcetv sourcenet ideo01 catholic protestant income01 male region

gen april=0

save marchred


********** END OF CODE
